Code
print("the current directory is")[1] "the current directory is"
Code
getwd()[1] "C:/Users/ANUP KAMATH/Documents/GitHub/R-Assignment"
Code
print("Lets set the directory as per our requirement")[1] "Lets set the directory as per our requirement"
Code
setwd("C:/Users/ANUP KAMATH/Documents/GitHub/R-Assignment")
print("The new directory is")[1] "The new directory is"
Code
getwd()[1] "C:/Users/ANUP KAMATH/Documents/GitHub/R-Assignment"
Code
#importing 1st file
file1<-read.csv(file="C:/Users/ANUP KAMATH/Desktop/children-born-per-woman.csv")
print("The first few rows of 1st file are")[1] "The first few rows of 1st file are"
Code
head(file1) Entity Code Year Fertility.rate..Gapminder..v12..2017.
1 Afghanistan AFG 1950 7.57
2 Afghanistan AFG 1951 7.56
3 Afghanistan AFG 1952 7.55
4 Afghanistan AFG 1953 7.54
5 Afghanistan AFG 1954 7.53
6 Afghanistan AFG 1955 7.52
Code
#importing 2nd file
file2<-read.csv(file="C:/Users/ANUP KAMATH/Desktop/world-happiness-report.csv")
print("The first few rows of 2nd file are")[1] "The first few rows of 2nd file are"
Code
head(file2) Country.name year Life.Ladder Log.GDP.per.capita Social.support
1 Afghanistan 2008 3.724 7.370 0.451
2 Afghanistan 2009 4.402 7.540 0.552
3 Afghanistan 2010 4.758 7.647 0.539
4 Afghanistan 2011 3.832 7.620 0.521
5 Afghanistan 2012 3.783 7.705 0.521
6 Afghanistan 2013 3.572 7.725 0.484
Healthy.life.expectancy.at.birth Freedom.to.make.life.choices Generosity
1 50.80 0.718 0.168
2 51.20 0.679 0.190
3 51.60 0.600 0.121
4 51.92 0.496 0.162
5 52.24 0.531 0.236
6 52.56 0.578 0.061
Perceptions.of.corruption Positive.affect Negative.affect
1 0.882 0.518 0.258
2 0.850 0.584 0.237
3 0.707 0.618 0.275
4 0.731 0.611 0.267
5 0.776 0.710 0.268
6 0.823 0.621 0.273
Code
#importing 3rd file
file3<-read.csv(file="C:/Users/ANUP KAMATH/Desktop/population_by_country_2020.csv")
print("The first few rows of 3rd file are")[1] "The first few rows of 3rd file are"
Code
head(file3) Country..or.dependency. Population..2020. Yearly.Change Net.Change
1 China 1440297825 0.39 % 5540090
2 India 1382345085 0.99 % 13586631
3 United States 331341050 0.59 % 1937734
4 Indonesia 274021604 1.07 % 2898047
5 Pakistan 221612785 2.00 % 4327022
6 Brazil 212821986 0.72 % 1509890
Density..P.Km.. Land.Area..Km.. Migrants..net. Fert..Rate Med..Age
1 153 9388211 -348399 1.7 38
2 464 2973190 -532687 2.2 28
3 36 9147420 954806 1.8 38
4 151 1811570 -98955 2.3 30
5 287 770880 -233379 3.6 23
6 25 8358140 21200 1.7 33
Urban.Pop.. World.Share
1 61 % 18.47 %
2 35 % 17.70 %
3 83 % 4.25 %
4 56 % 3.51 %
5 35 % 2.83 %
6 88 % 2.73 %